#Title: JavaScript Array Object

http://www.w3schools.com/js/js_arrays.asp

An Array object is used to store a set of values in a single variable name.


Examples

Array
Arrays are used to store a series of related data items. This example demonstrates how you can make an array that stores names.

Array 2
This is another way of making an array that gives the same result as the one above. Note that the length method is used to find out how many elements the array contains.


The Array object

An Array object is used to store a set of values in a single variable name. Each value is an element of the array and has an associated index number. 

You can refer to a particular element in the array by using the name of the array and the index number. The index number starts at zero. 

You create an instance of the Array object with the "new" keyword.

var family_names=new Array(5)

The expected number of elements goes inside the parentheses, in this case 5.

You assign data to each of the elements in the array like this:

family_names[0]="Tove"
family_names[1]="Jani"
family_names[2]="Stale"
family_names[3]="Hege"
family_names[4]="Kai"

And the data can be retrieved from any element by using the index of the particular array element you want. Like this:

mother=family_names[0]
father=family_names[1] 

The Array object's methods are described below:

NN: Netscape, IE: Internet Explorer, ECMA: Web Standard

Methods Explanation NN IE ECMA
length Returns the number of elements in an array. This property is assigned a value when an array is created 3.0 4.0 1.0
concat() Returns an array concatenated of two arrays 4.0 4.0 1.0
join() Returns a string of all the elements of an array concatenated together 3.0 4.0 1.0
reverse() Returns the array reversed  3.0 4.0 1.0
slice() Returns a specified part of the array 4.0 4.0  
sort() Returns a sorted array 3.0 4.0 1.0